<template>
  <div class="upload">
    <div class="uploadContainer">
      <!-- 上部 -->
      <div class="modType-top">
        <div
          v-for="(data, index) in uploadList.slice(0, 2)"
          :key="index"
          class="modType"
          @click="toModule(data.module)"
        >
          <img :src="require('@/assets/uploadPicture/' + data.name + '.jpg')" />
          <div class="introduction">
            <div class="icon">
              <img
                :src="
                  require('@/assets/uploadPicture/icon/' + data.name + '.png')
                "
              />
            </div>
            <span>{{ data.name }}</span>
          </div>
        </div>
      </div>
      <!-- 下部 -->
      <div class="modType-bottom">
        <div
          v-for="(data, index) in uploadList.slice(2)"
          :key="index"
          class="modType"
          @click="toModule(data.module)"
        >
          <img :src="require('@/assets/uploadPicture/' + data.name + '.jpg')" />
          <div class="introduction">
            <div class="icon">
              <img
                :src="
                  require('@/assets/uploadPicture/icon/' + data.name + '.png')
                "
              />
            </div>
            <span>{{ data.name }}</span>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>
    
<script>
/*eslint-disable*/
import pubsub from "pubsub-js";

export default {
  name: "Mod上传",
  props: {
    propsData: {
      type: Object,
      default: "",
    },
  },
  data() {
    return {
      uploadList: [
        {
          module: "faceUpload",
          name: "面补",
        },
        {
          module: "scoreboardUpload",
          name: "记分牌",
        },
        {
          module: "jerseyUpload",
          name: "NBA球衣",
        },
        {
          module: "courtUpload",
          name: "NBA地板",
        },
        {
          module: "blacktopUpload",
          name: "街头球场",
        },
      ],
    };
  },
  setup() {
    function toModule(module) {
      console.log(module);
      pubsub.publish("routerChange", {
        targetComponent: module,
        linkName: module,
        componentName: module,
        origin_nav: "upload",
      });
    }

    return {
      toModule,
    };
  },
};
</script>
    
<style lang="less" scoped>
@import "../less/variables.less";
.upload {
  height: 94%;
  width: 100%;
  position: relative;
  top: 3px;
  display: flex;
  align-items: flex-start;
  justify-content: center;
}
.uploadContainer {
  // border: @border;
  width: 100%;
  // height: 100%;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  max-width: 1400px;
  max-height: 900px;
  > .modType-top {
    // border: @border;
    flex: 0.3;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: row;
    > .modType {
      flex: 0.5;
      // height: 100%;
      position: relative;
      margin: 0 0.5%;
      height: 300px;
      > img {
        transition: left 0.3s ease;
      }
      > .introduction {
        width: 10%;
        height: 100%;
        display: flex;
        align-items: center;
        justify-content: center;
        flex-direction: column;
        > .icon {
          position: absolute;
          top: 5%;
        }
        > span {
          top: 0%;
          left: -100%;
          writing-mode: vertical-rl;
          transition: left 0.3s ease;
        }
      }
    }
    > .modType:hover > img {
      left: 10%;
    }
  }
  > .modType-bottom {
    margin-top: 1%;
    // border: @border;
    flex: 0.7;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: row;
    > .modType {
      flex: 0.35;
      // height: 95%;
      position: relative;
      margin: 0 1%;
      height: 570px;
      > img {
        transition: top 0.3s ease;
      }
      > .introduction {
        width: 100%;
        height: 10%;
        display: flex;
        align-items: center;
        justify-content: center;
        flex-direction: column;
        > .icon {
          position: absolute;
          left: 2.5%;
        }
        > span {
          left: 0%;
          top: -100%;
          transition: top 0.3s ease;
        }
      }
    }
    > .modType:nth-child(2) {
      margin: 0 1%;
    }
    > .modType:hover > img {
      top: 10%;
    }
  }
}

.modType {
  box-shadow: @box-shadow;
  border-radius: 5px;
  overflow: hidden;
  background-color: @red;
  > img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    border-radius: 5px;
    position: relative;
    left: 0%;
    top: 0%;
  }
  > .introduction {
    border-radius: 5px;
    background-color: transparent;
    position: absolute;
    top: 0%;
    left: 0%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    font-family: "华文中宋";
    font-size: 170%;
    > .icon {
      border-radius: 5px;
      width: 40px;
      height: 40px;
      display: flex;
      align-items: center;
      justify-content: center;
      background-color: @red;
      > img {
        object-fit: cover;
        width: 80%;
        height: 80%;
      }
    }
    > span {
      position: relative;
    }
  }
}

.modType:hover {
  box-shadow: 2px 2px 8px rgba(252, 61, 73, 0.7);
  cursor: pointer;
}

.modType:hover > .introduction > span {
  left: 0% !important;
  top: 0% !important;
}
</style>
    